import { keydownCondPairs } from '../common.js';
import { picState } from './use-task.js';
import { reasonList } from '../common.js';
import { useJudgeModal } from './use-judge.js';
import { UUID } from '@/util/rnd.js';

const Comment = () => ({
  id: UUID(),
  rejectReason: reasonList.value[0],
  remark: '',
  memberOf: 'comments',
});

export function useCommentCore() {
  picState.value.comments.push(Comment());
  useJudgeModal({ action: '批注' });
}

export default function useComment() {
  keydownCondPairs.push([event => 'i' == event.key, useCommentCore]);
}
